package com.surveillance.BO;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.surveillance.DAO.UserDAOImpl;
import com.surveillance.entities.User;

@Service("UserBO")
public class UserBO implements BOLayer<User>   {

	@Autowired
	private UserDAOImpl userDAO;

	public void setSurveillantDAO(UserDAOImpl userDAO) {
		this.userDAO = userDAO;
	}
	@Override
	public boolean save(User myEntity) {
		 userDAO.save(myEntity);
		 return true;
	}

	@Override
	public void update(User myEntity) {
		userDAO.update(myEntity);
		
	}

	@Override
	public void delete(User myEntity) {
		userDAO.delete(myEntity);
		
	}

	@Override
	public User findByID(Long myEntityID) {
		return userDAO.findByID(myEntityID);
	}

	@Override
	public List<User> findAll() {
		return userDAO.findAll();
	}
	
	public User authenticate(String login, String password){
		 return userDAO.authenticate(login, password);
	}
	

}
